<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="UTF-8">
<title>首页-软件下载|教程下载|科学软件|专业软件|共享软件|使用教程|项目咨询|数值模拟</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="软件下载|教程下载|科学软件交流组|专业软件|行业软件|水利软件|环境软件|数学软件|仿真软件|结构软件|机械软件|建筑软件|设计软件|优化软件|电力软件|信息软件|生物软件|预警软件|岩土软件|流体软件|后处理软件|BIM软件|化学软件|飞行器软件|交通软件|车辆软件|地质软件|医学软件|勘测软件|编程软件|常用工具|数值模拟|安装服务|培训服务|项目咨询服务|水利环境市政">
<meta name="author" content="idemon">

<!-- The styles -->
<link id="bs-css" href="${contextPath!}css/bootstrap-cerulean.min.css"
	rel="stylesheet">
<link href="${contextPath!}css/charisma-app.css" rel="stylesheet">
<link href='${contextPath!}css/jquery.iphone.toggle.css'
	rel='stylesheet'>
<!-- jQuery -->

<script src="${contextPath!}bower_components/jquery/jquery.min.js"></script>

<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- The fav icon -->
<link rel="shortcut icon" href="${contextPath!}img/favicon.ico">
<style type="text/css">
div.toolong {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	width: 250px;
}

div.toolong2 {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	width: 180px;
}
div.toolong3 {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	width: 220px;
}
</style>
</head>

<body>
	<!-- topbar starts -->
	<div class="navbar navbar-default" role="navigation">

		<div class="navbar-inner">
			<a class="navbar-brand" href="${contextPath!}"> <img alt="Logo"
				src="${contextPath!}img/logo20.png" class="hidden-xs" /> <span>首页</span></a>

			<!-- user dropdown starts -->
			<#if SESSION_USER??>
			<div class="btn-group pull-right">
				<button class="btn btn-default dropdown-toggle"
					data-toggle="dropdown">
					<i class="glyphicon glyphicon-user"></i><span
						class="hidden-sm hidden-xs">${SESSION_USER.name}</span> <span class="caret"></span>
				</button>
				<ul class="dropdown-menu">
					<li><a href="/usercenter/pdetail">个人中心</a></li>
					<li><a href="#" onclick="run1();">修改密码</a></li>
					<li class="divider"></li>
					<li><a href="/account/logout">退出</a></li>
				</ul>
			</div>
			<#else>
			<div class="btn-group pull-right">
				<button class="btn btn-default dropdown-toggle"
					data-toggle="dropdown" onclick="location.href='/account'">
					<i class="glyphicon glyphicon-user"></i><span
						class="hidden-sm hidden-xs">请登陆</span> <span class="caret"></span>
				</button>
			</div>
			</#if>
			<!-- user dropdown ends -->

			<ul class="collapse navbar-collapse nav navbar-nav top-menu">
				<li class="dropdown"><a href="#" data-toggle="dropdown"><i
						class="glyphicon glyphicon-star"></i> 软件 <span class="caret"></span></a>
					<ul class="dropdown-menu" role="menu">
						<#list initCategoryList! as x>
						<li><a href="/category/1-${x.cid!}">${x.name!}</a></li> </#list>
					</ul></li>
				<li class="dropdown"><a href="#" data-toggle="dropdown"><i
						class="glyphicon glyphicon-leaf"></i> 教程 <span class="caret"></span></a>
					<ul class="dropdown-menu" role="menu">
						<#list initCategoryList! as x>
						<li><a href="/category/2-${x.cid!}">${x.name!}教程</a></li> </#list>
					</ul></li>
				<li><a href="javascript:run3();"><i class="glyphicon glyphicon-envelope"></i>
						咨询 </a></li>
				<li>
					<form action="/search" method="post" class="navbar-search pull-left">
						<input placeholder="Search"
							class="search-query form-control col-md-10" name="key"
							type="text">
					</form>
				</li>
			</ul>

		</div>
	</div>
	<!-- topbar ends -->
	<div class="ch-container">
		<div class="row">
			<div id="content" class="col-lg-9 col-sm-9">
				<!-- content starts -->
				<div>
					<ul class="breadcrumb">
						<li><a href="#">首页</a></li>
					</ul>
				</div>

				<div id="datarow" class="row">
					<!-- 各个类型的软件模块 -->
					<!--/span-->
				</div>
				<!--/row-->

				<!-- content ends -->
			</div>
			<!--/#content.col-md-0-->

			<div class="box col-md-3">
				<div class="box-inner">
					<div class="box-header well" data-original-title="">
						<h2>最新软件排行榜</h2>
					</div>
					<div id="newdata" class="box-content"></div>
				</div>
			</div>

			<div class="box col-md-3">
				<div class="box-inner">
					<div class="box-header well" data-original-title="">
						<h2>软件下载排行榜</h2>
					</div>
					<div id="maxdown" class="box-content"></div>
				</div>
			</div>
		</div>
		<!--/fluid-row-->
		<hr>
		<!--buy software starts-->
	<div class="hide">
		<div id="buysoftware">
			<div class="form-group modal-body">
				<img alt="微信" src="/img/weixin.jpg" width="200" height="200"/>
				<img style="float:right" alt="QQ" src="/img/qq.png" width="200" height="200"/>
			</div>
		</div>
	</div>
  <!--buy software ends-->
		<!--modify password starts-->
		<div class="hide">
			<div id="modifypassword">
				<form id="loginform">
					<div class="form-group">
						<label for="password">原密码</label> <input name="orgpass" type="password"
							class="form-control" id="password">
					</div>
					<div class="form-group">
						<label for="password">新密码</label> <input name="newpass" type="password"
							class="form-control" id="password">
					</div>
					<div class="form-group">
						<label for="password">重复新密码</label> <input name="repass" type="password"
							class="form-control" id="password">
					</div>
				</form>
			</div>
		</div>
		<!--modify password ends-->
		<footer class="row">
			<p class="col-md-9 col-sm-9 col-xs-12 copyright">
				&copy; <a href="http://www.idemon.com.cn/" target="_blank">idemon</a>
				2015 - 2017
			</p>
			<p class="col-md-3 col-sm-3 col-xs-12 powered-by">
				Powered by: <a href="http://www.idemon.com.cn/">Idemon</a>
			</p>
		</footer>
	</div>
	<!--/.fluid-container-->

	<!-- external javascript -->
	<script src="${contextPath!}bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- library for cookie management -->
	<script src="${contextPath!}js/jquery.cookie.js"></script>
	<!-- calender plugin -->
	<script src='${contextPath!}bower_components/moment/min/moment.min.js'></script>
	<script src='${contextPath!}bower_components/fullcalendar/dist/fullcalendar.min.js'></script>

	<!-- data table plugin -->
	<script src='${contextPath!}js/jquery.dataTables.min.js'></script>
	<!-- select or dropdown enhancer -->
	<script src="${contextPath!}bower_components/chosen/chosen.jquery.min.js"></script>
	<!-- plugin for gallery image view -->
	<script src="${contextPath!}bower_components/colorbox/jquery.colorbox-min.js"></script>
	<!-- star rating plugin -->
	<script src="${contextPath!}js/jquery.raty.min.js"></script>
	<!-- for iOS style toggle switch -->
	<script src="${contextPath!}js/jquery.iphone.toggle.js"></script>
	<!-- autogrowing textarea plugin -->
	<script src="${contextPath!}js/jquery.autogrow-textarea.js"></script>
	<!-- multiple file upload plugin -->
	<script src="${contextPath!}js/jquery.uploadify-3.1.min.js"></script>
	<!-- history.js for cross-browser state change on ajax -->
	<script src="${contextPath!}js/jquery.history.js"></script>
	<!-- application script for Charisma demo -->
	<script src="${contextPath!}js/charisma.js"></script>
	<!-- dialog -->
	<script src="${contextPath!}js/jquery.bootstrap.min.js"></script>
	<script>
		//修改密码   开始
		function run1() {
			$("#modifypassword").dialog({
				title : "修改密码",
				'class' : "mydialog" /*add custom class for this dialog*/
				,
				onClose : function() {
					$(this).dialog("close");
				},
				buttons : [ {
					text : "关闭",
					'class' : "btn btn-default",
					click : function() {
						$(this).dialog("close");
					}
				}, {
					text : "提交",
					'class' : "btn btn-primary",
					click : function() {
						/*your login handler*/
						$thisdialog = $(this);
						$("#errormsg").remove();
						$.post("/usercenter/updpass", $("#loginform").serialize(),function(json){
					     	if(json.code == 0){
					     		$("#loginform").prepend($("<div></div>").attr("id","errormsg").addClass("alert alert-danger").text(json.msg));
					     	}else if(json.code == 1){
					     		$thisdialog.dialog("close");
					     	}else{
					     		$thisdialog.dialog("close");
					     	}
					    });
					}
				} ]
			});
		}
		//修改密码   结束
		//弹出微信QQ start
	function run3(){
      $("#buysoftware").dialog({
          title:    "请加微信或QQ联系我们"
        , 'class':  "mydialog"  /*add custom class for this dialog*/
        , onClose: function() { $(this).dialog("close"); }
      });
	}
	//弹出微信QQ end
		//各个类型的软件
		function initSoft() {
			$.getJSON("/init/allsoft",function(json) {
				$datarow = $("#datarow");
				var htmlrow = "";
				$.each(json,function(i, item) {
					htmlrow += "<div class='box col-md-6'>";
					htmlrow += "<div class='box-inner'>";
					htmlrow += "<div class='box-header well' data-original-title=''>";
					htmlrow += "<h2>";
					htmlrow += item.name;
					htmlrow += "</h2>";
					htmlrow += "<div class='box-icon'>";
					htmlrow += "<a href='/category/1-";
					htmlrow += item.cid;
					htmlrow += "' title='查看更多' data-toggle='tooltip' class='btn btn-round btn-default'><i class='glyphicon glyphicon-fullscreen'></i></a>";
					//htmlrow += "<a href='#' class='btn btn-close btn-round btn-default'><i class='glyphicon glyphicon-remove'></i></a>";
					htmlrow += "</div>";
					htmlrow += "</div>";
					htmlrow += "<div class='box-content'>";
					htmlrow += "<table class='table'>";
					htmlrow += "<thead>";
					htmlrow += "<tr>";
					htmlrow += "<th colspan='2'>软件名称</th>";
					htmlrow += "<th>更新时间</th>";
					htmlrow += "</tr>";
					htmlrow += "</thead>";
					htmlrow += "<tbody>";
					$.each(item.softwares,function(i, software) {
						htmlrow += "<tr>";
						htmlrow += "<td class='col-md-2'><a href='/detail/";
						htmlrow += software.sid;
						htmlrow += "'><img src='/images/";
						htmlrow += software.logo;
						htmlrow += "' width='40' height='40'/></a></td>";
						htmlrow += "<td class='col-md-7'><h5><a href='/detail/";
						htmlrow += software.sid;
						htmlrow += "'><div title='";
						htmlrow += software.name;
						htmlrow += "' data-placement='left' data-toggle='tooltip' class='toolong3'>";
						htmlrow += software.name;
						htmlrow += "</div></a></h5></td>";
						htmlrow += "<td class='center col-md-3'><h5>";
						htmlrow += software.modify_date;
						htmlrow += "</h5></td>";
						htmlrow += "</tr>";
					});
					htmlrow += "</tbody>";
					htmlrow += "</table>";
					htmlrow += "</div>";
					htmlrow += "</div>";
					htmlrow += "</div>";
				});
				$datarow.html(htmlrow);
			});
		}
		//软件下载排行榜
		function initMaxdown() {
			$.getJSON("/init/maxdown", function(json) {
				$.each(json, function(i, item) {
					$rowdiv = $("<div></div>").addClass("row");
					$coldiv = $("<div></div>").addClass("col-md-12");
					$ahref = $("<a></a>").attr("href", "/detail/" + item.sid);
					$toolongdiv = $("<div data-placement='left' data-toggle='tooltip'></div>").attr("title",item.name).addClass("toolong").append("<H3></h3>").text(
							(i + 1) + "." + item.name);
					$("#maxdown").append(
							$rowdiv.append($coldiv.append($("<h6></h6>")
									.append($ahref.append($toolongdiv)))));
				});
			});
		}
		//最新软件排行榜
		function intiNewdata() {
			$.getJSON("/init/newdata", function(json) {
				$.each(json, function(i, item) {
					$rowdiv = $("<div></div>").addClass("row");
					$coldiv = $("<div></div>").addClass("col-md-12");
					$ahref = $("<a></a>").attr("href", "/detail/" + item.sid);
					$toolongdiv = $("<div data-placement='left' data-toggle='tooltip'></div>").attr("title",item.name).addClass("toolong").text(
							(i + 1) + "." + item.name);
					$("#newdata").append(
							$rowdiv.append($coldiv.append($("<h6></h6>")
									.append($ahref.append($toolongdiv)))));
				});
			});
		}

		$(function($) {
			//各个类型的软件
			initSoft();
			//最新软件排行榜
			initMaxdown();
			//软件下载排行榜
			intiNewdata();
		});
	</script>
</body>
</html>
